/* Define to 1 if you have a working `mmap' system call. */
#mesondefine HAVE_MMAP
+/* Define to 1 if you have a working `madvise' system call. */
+#mesondefine HAVE_MADVISE
+
/* Define to 1 if you have the `posix_fallocate' function. */
#mesondefine HAVE_POSIX_FALLOCATE
DEBUG_ALLOC ("gtk-secure-memory: new block ", *sz);
-#if defined(MADV_DONTDUMP)
+#if defined(HAVE_MADVISE) && defined(MADV_DONTDUMP)
if (madvise (pages, *sz, MADV_DONTDUMP) < 0) {
if (show_warning && gtk_secure_warnings) {
/*
cdata.set('HAVE_UINT128_T', 1)
endif
-# Check for mlock
+# Check for mlock and madvise
if cc.has_function('mlock', prefix: '#include <sys/mman.h>')
cdata.set('HAVE_MLOCK', 1)
endif
+if cc.has_function('madvise', prefix: '#include <sys/mman.h>')
+ cdata.set('HAVE_MADVISE', 1)
+endif
# Disable deprecation checks for all libraries we depend on on stable branches.
# This is so newer versions of those libraries don't cause more warnings with